package com.kingsoft.dc.khaos.plugin.core;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * 配置信息.
 */
public class KhaosConf {
    private Map<String, Object> setting = new HashMap<String, Object>();
    private String propertiesFile = null;

    private Properties defaultProperties;

    public String getPropertiesFile() {
        return propertiesFile;
    }

    public void setPropertiesFile(String propertiesFile) {
        this.propertiesFile = propertiesFile;
    }

    public Map<String, Object> getSetting() {
        return setting;
    }

    public void setSetting(Map<String, Object> setting) {
        this.setting = setting;
    }

    public String getString(String key) {
        return setting.get(key).toString();
    }


    public Boolean contains(String key) {
        return setting.containsKey(key);
    }

    public String getString(String key, String defaultValue) {
        return setting.getOrDefault(key, defaultValue).toString();
    }

    public Object get(String key) {
        return setting.get(key);
    }

    public void set(String key, Object value) {
        setting.put(key, value);
    }

    public int getInt(String key) {
        return Integer.parseInt(setting.get(key).toString());
    }

    public int getInt(String key, int defaultValue) {
        return Integer.parseInt(setting.getOrDefault(key, defaultValue).toString());
    }

    public void validateSettings(){};
}
